/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jpa;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "documento")
@NamedQueries({
    @NamedQuery(name = "Documento.cercaDescrizione", query="Select d From Documento d Where d.descr like '%:descr%'"),
    @NamedQuery(name = "Documento.cercaTitolo", query="Select d From Documento d Where d.titolo like '%:titolo%'"),
    @NamedQuery(name = "Documento.countFile", query="SELECT COUNT(d.id) FROM Documento d"),
    @NamedQuery(name = "Documento.findAll", query = "SELECT d FROM Documento d"),
    @NamedQuery(name = "Documento.findById", query = "SELECT d FROM Documento d WHERE d.id = :id"),
    @NamedQuery(name = "Documento.findByLink", query = "SELECT d FROM Documento d WHERE d.link = :link"),
    @NamedQuery(name = "Documento.findByApprovazioneDocumentoid", query = "SELECT d FROM Documento d WHERE d.approvazioneDocumentoid = :approvazioneDocumentoid"),
    @NamedQuery(name = "Documento.findByCorsiid", query = "SELECT d FROM Documento d WHERE d.corsiid = :corsiid"),
    @NamedQuery(name = "Documento.findByTitolo", query = "SELECT d FROM Documento d WHERE d.titolo = :titolo"),
    @NamedQuery(name = "Documento.findByDescr", query = "SELECT d FROM Documento d WHERE d.descr = :descr"),
    @NamedQuery(name = "Documento.findByUploadid", query = "SELECT d FROM Documento d WHERE d.uploadid = :uploadid")})

public class Documento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "link")
    private String link;
    @Column(name = "approvazioneDocumentoid")
    private Integer approvazioneDocumentoid;
    @Column(name = "corsiid")
    private Integer corsiid;
    @Column(name = "titolo")
    private String titolo;
    @Column(name = "descr")
    private String descr;
    @Column(name = "uploadid")
    private Integer uploadid;

    public Documento() {
    }

    public Documento(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public Integer getApprovazioneDocumentoid() {
        return approvazioneDocumentoid;
    }

    public void setApprovazioneDocumentoid(Integer approvazioneDocumentoid) {
        this.approvazioneDocumentoid = approvazioneDocumentoid;
    }

    public Integer getCorsiid() {
        return corsiid;
    }

    public void setCorsiid(Integer corsiid) {
        this.corsiid = corsiid;
    }

    public String getTitolo() {
        return titolo;
    }

    public void setTitolo(String titolo) {
        this.titolo = titolo;
    }

    public String getDescr() {
        return descr;
    }

    public void setDescr(String descr) {
        this.descr = descr;
    }

    public Integer getUploadid() {
        return uploadid;
    }

    public void setUploadid(Integer uploadid) {
        this.uploadid = uploadid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Documento)) {
            return false;
        }
        Documento other = (Documento) object;
        return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
    }

    @Override
    public String toString() {
        return "jpa.Documento[id=" + id + "]";
    }

}
